package Classes.GameViews.ViewPanels
{
	import Classes.GameDatas.GD_Player;
	import Classes.GameViews.ViewScenes.VS_Main;
	import Classes.Managers.M_Communication;
	
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.system.ApplicationDomain;

	/** 
	 * @author thy
	 * @version 1.0.0 
	 * 创建时间：Apr 19, 2012 9:11:49 PM 
	 */ 
	public class VP_QQhzDayGift extends ViewPanel
	{
		private static var _instance:VP_QQhzDayGift;
		private var _interfaceUI:Sprite;
		public function VP_QQhzDayGift()
		{
			this.init();
		}
		
		private function init():void
		{
			this._interfaceUI=new (ApplicationDomain.currentDomain.getDefinition("QQVipDayGift_v") as Class);
			this.addChild(this._interfaceUI);
			this.addListener();
		}
		
		private function addListener():void
		{
			this.addEventListener("close",closeHandler);
			this.addEventListener("customCallBack",customHandler);
		}
		
		private function customHandler(e:Event):void
		{
			//领取
			M_Communication.instance.send(11004,{type:2});
		}
		
		/**
		 * 打开黄钻礼包弹框
		 */	
		public function openQQWin(dayArr:Array,yearObj:Object,nextArr:Array):void
		{
			var isYear:Boolean=GD_Player.instance.qqVipId>=101?true:false;
			this._interfaceUI["controlView"](isYear,GD_Player.instance.qqVipId,dayArr,yearObj,nextArr);
			this.openAt(VS_Main.instance,true);
			this.toCenter();
		}
		
		/**
		 * 控制领取按钮 
		 * @param flag
		 */		
		public function contrlLqBtn(flag:Boolean=true):void
		{
			this._interfaceUI["contrlLqBtn"](flag);
		}
		
		
		public function closeHandler(e:Event):void
		{
			this.close();
		}
		
		public static function get instance():VP_QQhzDayGift
		{
			if(!_instance)_instance=new VP_QQhzDayGift();
			return _instance;
		}
		
		public function get interfaceUI():Sprite
		{
			return _interfaceUI;
		}
	}
}
